package com.example.clients;

import com.example.pojo.Discuss;
import com.example.pojo.Posts;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "post-server", url = "http://localhost:8083")
public interface PostsClient {

    @GetMapping("/posts/getAll")
    List<Posts> getAll();

    @GetMapping("/posts/addPost")
    void addPost(@RequestParam("uid") Integer uid,@RequestParam("bid") Integer bid,@RequestParam("title") String title,
                 @RequestParam("content") String content,@RequestParam("images") String images);
    //帖子的评论部分
    @GetMapping("/posts/getDiscuss")
    List<Discuss> getDiscuss(@RequestParam("pid") Integer pid);

    @GetMapping("/posts/addDiscuss")
    void addDiscuss(@RequestParam("uid") Integer uid,@RequestParam("text") String text,@RequestParam("pid") Integer pid);

    @GetMapping("/posts/getDiscuss_Bar")
    List<Posts> getDiscuss_Bar(@RequestParam("bid") Integer bid,@RequestParam("uid") Integer uid);

    @GetMapping("/posts/getDiscuss_User")
    List<Posts> getDiscuss_User(@RequestParam("uid") Integer uid);

    @GetMapping("/posts/findPostByPid")
    Posts findPostByPid(@RequestParam("pid") Integer pid);
    @GetMapping("/posts/findpbu")
    List<Posts>  findPostByPidUid(@RequestParam("pid") Integer pid,@RequestParam("uid") Integer uid);
    @GetMapping("/posts/history")
    List<Posts>  history(@RequestParam("uid") Integer uid);

    @GetMapping("/posts/moveHistory")
    void moveHistory(@RequestParam("uid") Integer uid,@RequestParam("pid") Integer pid);

    @GetMapping("/posts/belike")
    void belike(@RequestParam("uid") Integer uid,@RequestParam("sc") Integer sc,@RequestParam("pid") Integer pid);

    @GetMapping("/posts/getDiscuss_Pid")
    Posts getDiscuss_Pid(@RequestParam("pid") Integer pid);

    @GetMapping("/posts/delPosts")
    void delPosts(@RequestParam("pid") Integer pid);

    @GetMapping("/posts/delDis")
    void delDis(@RequestParam("cid") Integer cid);

    @GetMapping("/posts/getAllDis")
    Integer getAllDis();
}
